/*	Copyright 2007 - Xavier Baro (xbaro@cvc.uab.cat)

	This file is part of eapmlib.

    Eapmlib is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or any 
	later version.

    Eapmlib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ADDITIVECLASSENSEMBLE_H__
#define __ADDITIVECLASSENSEMBLE_H__

#include "EvolutiveLib.h"
#include "ClassEnsemble.h"

namespace Evolutive {

	//! Class that codifies an ensemble of classifiers
	class EVOLUTIVELIB_API CAdditiveClassEnsemble : public CClassEnsemble
	{
		//! Methods
	public:
		//! Default constructor		
		CAdditiveClassEnsemble(void);

		//! Default destructor
		virtual ~CAdditiveClassEnsemble(void);

#ifdef USE_OPENCV
		//! Returns the class name (From base class)
		virtual string GetClassNameID(void) {return "CAdditiveClassEnsemble";}

		//! Add a new classifier to the ensemble (overload from base class)
		void AddClassifier(CClassifier *Classifier);

		//! Redefinition to allows the addition of a weight
		void AddClassifier(CClassifier *Classifier,double Weight);

		//! Classify a given data (From base class)
		virtual double Apply(CData *InputData);

		//! Returns the classifier weight
		double GetWeight(int Idx);

		//! Save or recover the data to/from a file (from base class)
		virtual void Serialize(std::fstream &fs,bool Saving);
			
#endif //USE_OPENCV					
	protected:
					
		//! Attributes
	protected:					

		//! Classifiers weight
		CDblVector m_ClassWeight;
	};	
}

#endif // __ADDITIVECLASSENSEMBLE_H__
